﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.Net.Sockets;

namespace Simhopp.Model
{
    public class Judge : InterfaceJudgeModel
    {
        public int ID { get; set; }

        public string Name { get; set; }
        public Countries Nationality { get; set; }
        public string Password { get; set; }
        public string Username { get; set; }

        public Judge()
        {
            this.ID = 0;
            this.Name = "";
            this.Nationality = Countries.Afghanistan;
            this.Password = "";
            this.Username = "";
        }

        public Judge(string Name, Countries Nationality, string Password, string Username)
        {
            this.ID = 0;
            this.Name = Name;
            this.Nationality = Nationality;
            this.Password = Password;
            this.Username = Username;
        }

        public Judge(int ID, string Name, Countries Nationality, string Password, string Username)
        {
            this.ID = ID;
            this.Name = Name;
            this.Nationality = Nationality;
            this.Password = Password;
            this.Username = Username;
        }

        public int SendResult(string points, Socket socket, string port)
        {
            string msg = this.ID + "@" + this.Name + "@" + points + "@" + port;
            int s = socket.Send(Encoding.Default.GetBytes(msg));

            return s;
        }
    }
}


